<template>
    <div>
      <p class="pls">节目排行</p>
      <ul class="ul1">
        <li @click="votevi(item)" v-for="(item,index) in rankData" :key="index">
          <div class="s-left">
            <img :src="item.img" alt="">
            <span>{{item.name}}</span>
          </div>
          <span>{{item.vote}}票</span>
        </li>
      </ul>

      <ul class="ul2">
        <li v-for="(item,index) in data" :key="index">
          <router-link :to="item.path">
            {{item.txt}}<p v-if="$route.params.id2==index"></p>
          </router-link>
        </li>
      </ul>
    </div>
</template>

<script>
  import * as list from "../../../api/list.js";
    export default {
      name: "Showout",
      data(){
        return {
          rankData:[],
          data:[
            {path:'/vote/4/showout/0/'+this.$route.params.id3,txt:'节目排行'},
            {path:'/vote/4/ranking/1/'+this.$route.params.id3,txt:'人气排行'},
            {path:'/vote/4/voting/2/'+this.$route.params.id3,txt:'投票说明'}
          ]
        }
      },
      beforeMount(){
        let parmes5 = {active_id:this.$route.params.id3,type:1};
        list.voteRank(parmes5).then(res=>{
          console.log('节目',res.data);
          this.rankData = res.data;
        })
      },
      mounted(){
        mui.back = function() {
          window.history.go(-1);
        }
      },
      methods:{
        votevi(item){
           this.$router.push('/vote/4/voteshow/'+item.id+'/'+this.$route.params.id3);
        }
      }
    }
</script>

<style scoped>
  .pls{
    font-size: 28px;
    padding-left: 40px;
    border-bottom: 1px solid #dcdcdc;
  }
  .ul1 li{
    border-bottom: 1px solid #dcdcdc;
    padding: 20px 40px;
    display: flex;
    justify-content: space-between;
  }
  .ul1 li:last-child{
    border-bottom:0;
  }
  .ul1 li .s-left{
    display: flex;
  }
  .ul1 li .s-left img{
    width: 180px;
    height: 100px;
  }
  .ul1 li .s-left span{
    font-size: 28px;
    align-self: center;
    margin-left: 20px;
  }
  .ul1 li>span{
    font-size: 24px;
    color: #fff;
    background: #e98345;
    width: 150px;
    height: 40px;
    align-self: center;
    text-align: center;
    line-height: 40px;
    border-radius: 5px;
  }

  .ul2{
    display: flex;
    justify-content: space-between;
  }
  .ul2 li{
    position: relative;
    flex-grow: 1;
    font-size: 26px;
    border-right: 1px solid #444;
    text-align: center;
  }
  .ul2 li p{
    position: absolute;
    left: 50%;
    margin-left: -52px;
    bottom: -20px;
    width: 104px;
    border: 2px solid #e98345;
  }
  .ul2 li:last-child{
    border: none;
  }
</style>
